﻿#ifndef ATTENDANCELIST_H
#define ATTENDANCELIST_H

#include <QWidget>
#include "common.h"

namespace Ui {
class AttendanceList;
}

class AttendanceList : public QWidget {
    Q_OBJECT

  public:
    explicit AttendanceList(QWidget *parent = nullptr);
    ~AttendanceList();
    int getCurrentPage();
    int getTotalRecord();
    void setTotalRecord(int totalRecord);
    int getTotalPage();
    void setTotalPage(int totalPage);
    QString getCurrentSearchUsername();
    QString getCurrentSearchStartTime();
    QString getCurrentSearchEndTime();
    void initList();
    void initWidget();
    void getAttendanceList(int page, int pageSize, QString currentSearchUsername,
                           QString currentSearchStartTime, QString currentSearchEndTime);
    void setPageShow(int count);
    void showAttendanceList(QList<AInfo> &attendanceInfoList);
    void clearAttendanceList();
    void refreshAttendanceList();

  private slots:
    void on_searchButton_clicked();

    void on_lastPageButton_clicked();

    void on_nextPageButton_clicked();

  private:
    Ui::AttendanceList *ui;
    int currentPage;    // 当前页面
    int totalRecord;    // 总记录数
    int totalPage;      // 总页数
};

#endif // ATTENDANCELIST_H
